<%--
  Created by IntelliJ IDEA.
  User: xianfei
  Date: 15-3-16
  Time: 上午10:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <title>会员管理</title>
    <script>
        function addMember() {
            window.open("/member/show/1");
        }

        $(function () {
            $("#btn_check").click(function () {
                var name = $("#name").val();
                var idCard = $("#idCard").val();
                var phoneNum = $("#phoneNum").val();
                $.ajax({
                    url: '/member/listByMore',
                    type: 'POST',
                    dataType: 'json',
                    data:"name="+name+"&idCard="+idCard+"&phoneNum="+phoneNum,
                    success: function (data) {
                        $("tbody").empty();
                        $("tbody").html(data);
                    },
                    error: function (e) {
                        alert("error");
                    }
                })
            });
        });
    </script>
</head>
<body>
<div>
    <button type="button" class="btn btn-primary" onclick="addMember()" title="添加会员">新增会员</button>
    &nbsp;
    查询条件:&nbsp;
    姓名:<input type="text" id="name"/>&nbsp;
    身份证:<input type="text" id="idCard"/>&nbsp;
    手机号:<input type="text" id="phoneNum"/>&nbsp;
    <input type="button" id="btn_check" value="查询">
</div>
<table class="table table-striped">
    <thead>
    <th style="width:4%">序号</th>
    <th style="width:10%">姓名</th>
    <th style="width:4%">性别</th>
    <th style="width:10%">身份证号码</th>
    <th style="width:8%">电话号码</th>
    <th style="width:8%">入会日期</th>
    <th style="width:10%">籍贯</th>
    <th style="width:10%">操作</th>
    </thead>
    <tbody>
    <c:forEach items="${memberDTOs}" var="memberDTO" varStatus="status">
        <tr>
            <td>${status.index+1}</td>
            <td>${memberDTO.name}</td>
            <td>${memberDTO.gender}</td>
            <td>${memberDTO.idCard}</td>
            <td>${memberDTO.phoneNum}</td>
            <td>${memberDTO.initiateDate}</td>
            <td>${memberDTO.idCardAddress}</td>
            <td><a href="/member/show/${memberDTO.guid}">详情信息</a>&nbsp;<a href="/member/delete/${memberDTO.guid}">删除</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>

</body>
</html>